<!DOCTYPE html>
<html lang="en">

<head>
  <base href="./">
  <meta charset="utf-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="width=device-width, initial-scale=1.0, shrink-to-fit=no">
  <meta name="description" content="CoreUI - Open Source Bootstrap Admin Template">
  <meta name="author" content="Łukasz Holeczek">
  <meta name="keyword" content="Bootstrap,Admin,Template,Open,Source,jQuery,CSS,HTML,RWD,Dashboard">
  <title>商品展示</title>
  <!-- Icons-->
  <link href="../vendors/@coreui/icons/css/coreui-icons.min.css" rel="stylesheet">
  <link href="../vendors/flag-icon-css/css/flag-icon.min.css" rel="stylesheet">
  <link href="../vendors/font-awesome/css/font-awesome.min.css" rel="stylesheet">
  <link href="../vendors/simple-line-icons/css/simple-line-icons.css" rel="stylesheet">
  <link href="../css/style.css" rel="stylesheet">
  <link href="../vendors/pace-progress/css/pace.min.css" rel="stylesheet">

  <style>
    /*悬浮*/
    .sale:hover {

      transform: scale(1.001, 1.001);
      cursor: pointer;
    }

    .sale a {
      color: black;
      text-decoration: none;
      /*去除下划线*/
    }

    .price {
      color: red;
      font-weight: bold;
      font-size: 20px;
      position: relative;
      text-align: center;
    }

    h3 {
      text-align: center;
      position: relative;
    }

  </style>
  <style type="text/css">
    .col-xs-1-5,
    .col-sm-1-5,
    .col-md-1-5,
    .col-lg-1-5 {
      position: relative;
      min-height: 1px;
      padding-right: 10px;
      padding-left: 10px;
    }

    .col-xs-1-5 {
      width: 20%;
      float: left;
    }

    @media (min-width: 768px) {
      .col-sm-1-5 {
        width: 20%;
        float: left;
      }
    }

    @media (min-width: 992px) {
      .col-md-1-5 {
        width: 20%;
        float: left;
      }
    }

    @media (min-width: 1200px) {
      .col-lg-1-5 {
        width: 20%;
        float: left;
      }
    }
  </style>
</head>



<body class="app header-fixed sidebar-fixed aside-menu-fixed pace-done sidebar-lg-show">
  <header class="app-header navbar">
    <button class="navbar-toggler sidebar-toggler d-lg-none mr-auto" type="button" data-toggle="sidebar-show">
      <span class="navbar-toggler-icon"></span>
    </button>

    <button class="navbar-toggler sidebar-toggler d-md-down-none" type="button" data-toggle="sidebar-lg-show">
      <span class="navbar-toggler-icon"></span>
    </button>
    <div class="btn-group" role="group" aria-label="Button group">
      <p class="btn"> 你好，无敌的 销售员！</p>
      <a class="btn" href="/api/emp/logout">
        <i class="fa fa-share" aria-hidden="true"></i> &nbsp;退出</a>
    </div>

  </header>
  <div class="app-body">
    <div class="sidebar">
      <nav class="sidebar-nav ps ps--active-y">
        <ul class="nav">
          <br>
          <li class="nav-item nav-dropdown ">
            <a class="nav-link nav-dropdown-toggle" href="#">
              <i class="nav-icon icon-puzzle"></i> 客户信息</a>
            <ul class="nav-dropdown-items">
              <li class="nav-item">
                <a class="nav-link" href="/salesman/salesman_add_user">
                  <i class="fa fa-user-plus" aria-hidden="true"></i>&nbsp;添加客户</a>
              </li>
              <li class="nav-item">
                <a class="nav-link" href="/salesman/salesman_manage_user">
                  <i class="fa fa-eye" aria-hidden="true"></i>&nbsp;查看客户</a>
              </li>
            </ul>
          </li>
          <br><br>
          <li class="nav-item nav-dropdown">
            <a class="nav-link nav-dropdown-toggle" href="#">
              <i class="nav-icon icon-star"></i>商城</a>
            <ul class="nav-dropdown-items">
              <li class="nav-item">
                <a class="nav-link" href="/salesman/salesman_show_goods">
                  <i class="fa fa-shopping-basket" aria-hidden="true"></i>&nbsp;商品展示</a>
              </li>
              <li class="nav-item">
                <a class="nav-link" href="/salesman/salesman_manage_order">
                  <i class="icon-speech"></i>&nbsp;订单管理</a>
              </li>
            </ul>
          </li>
          <br><br>
          <li class="nav-item nav-dropdown">
            <a class="nav-link nav-dropdown-toggle" href="#">
              <i class="nav-icon icon-cursor"></i>个人中心</a>
            <ul class="nav-dropdown-items">
              <li class="nav-item">
                <a class="nav-link" href="/salesman/salesman_security">
                  <i class="icons cui-shield"></i> &nbsp;账号安全</a>
              </li>
              <li class="nav-item">
                <a class="nav-link" href="/salesman/salesman_personal_information">
                  <i class="fa fa-bar-chart" aria-hidden="true"></i> &nbsp;个人信息</a>
              </li>

            </ul>
          </li>

        </ul>
        <div class="ps__rail-x" style="left: 0px; bottom: 0px;">
          <div class="ps__thumb-x" tabindex="0" style="left: 0px; width: 0px;"></div>
        </div>
        <div class="ps__rail-y" style="top: 0px; height: 445px; right: 0px;">
          <div class="ps__thumb-y" tabindex="0" style="top: 0px; height: 297px;"></div>
        </div>
      </nav>
      <button class="sidebar-minimizer brand-minimizer" type="button"></button>
    </div>
    <main class="main">
      <!-- Breadcrumb-->
      <ol class="breadcrumb">
        <li class="breadcrumb-item" style="margin-top: 8px;">你的位置：商城->商品展示</li>
        <li class="nav-item dropdown ml-auto ">
          <div class="controls">
            <div class="input-group">
              <input class="form-control" id="appendedInputButton" size="16" type="text">
              <span class="input-group-append">
                <button class="btn btn-secondary" type="button"> <i class="fa fa-search"
                    aria-hidden="true"></i></button>
              </span>
            </div>
          </div>
        </li>
        <ul class="nav navbar-nav ml-auto">
          <li class="nav-item dropdown">
            <a class="nav-link" href="./salesman_shop_cart.html">
              <i class="fa fa-shopping-cart fa-2x" aria-hidden="true"></i>
              <span class="badge badge-pill badge-danger" id="goodsNum">0</span>
            </a>
          </li>

        </ul>

      </ol>
      <div id="itemsTemplate">
        <div class="container-fluid">
          <div class="animated fadeIn">
            <div class="row" v-for="(item,index) in items" v-if="index % 4 == 0">

              <div class="col-sm-6 col-lg-3" v-for="i in 4" v-if="items[i-1+index] != null">
                <div class="sale">
                  <div class="card" style="width: 19rem;">
                    <a :href="'./salesman_details_goods.html?goodsId='+items[i-1+index].goodsId+''">
                      <img  v-bind:src="items[i-1+index].goodsCoverImg" class="card-img-top" height="270" width="250">
                      <div class="card-body">
                        <h3 class="card-title">{{items[i-1+index].goodsName}}</h3>
                        <p class="card-text" style="font-family:微软雅黑 ;color: rgb(165, 154, 154);">{{items[i-1+index].goodsIntro}}</p>
                        <div class="price">{{items[i-1+index].goodsSellingPrice}}</div>
                      </div>
                    </a>
                  </div>
                </div>
              </div>
            </div>
          </div>
        </div>
      </div>
    </main>
  </div>

  <script src="../vendors/jquery/js/jquery.min.js"></script>
  <script src="../vendors/popper.js/js/popper.min.js"></script>
  <script src="../vendors/bootstrap/js/bootstrap.min.js"></script>
  <script src="../vendors/pace-progress/js/pace.min.js"></script>
  <script src="../vendors/perfect-scrollbar/js/perfect-scrollbar.min.js"></script>
  <script src="../vendors/@coreui/coreui/js/coreui.min.js"></script>
  <script src="../vendors/@coreui/coreui-plugin-chartjs-custom-tooltips/js/custom-tooltips.min.js"></script>
  <script src="../vendors/mock.js/js/mock.min.js"></script>
  <script src="../vendors/vue.js/js/vue.min.js"></script>
  <script>
    var p, d, j;
    var app;
    var items;
    var goodsNum;
    $(function () {
      Mock.mock("http://127.0.0.1:5500/users", {
        "data|20-20": [{
          id: "@increment()",//编号
          goodsId: "@increment()",//商品编号
          "goodsnName|1": ["@cname", "@name"],//商品姓名
          goodsSellingPrice: "@increment()",//商品零售价
          goodsCostPrice: "@increment()",//商品成本价
          goodsCoverImg: "@cname()",//商品图片
          goodsDetailContent: "@cname()",//商品信息描述 
          goodsIntro: "@cname()",//商品信息简介
          createTime: "@datetime()",//创建时间


        }],
        suceess: true,
        code: 200,
        msg: "Success"
      });

      $.getJSON("/api/shoppingCartItemNum", function (response) {
        console.log(response.data)
        goodsNum = response.data;
        document.getElementById("goodsNum").innerHTML = goodsNum;
      });
      $.getJSON("/goods/list", function (response) {
        items = response.data;
        console.log(response.data)
        page = Math.ceil(items.length / 5);
        var pageitem = [];
        for (var i = 0; i < page; i++) {
          pageitem[i] = i + 1;
        }
        app = new Vue({
          el: '#itemsTemplate',
          data: {
            items: items,
            checkall: false,
            pagesum: page,//总页码
            pageindex: 1,//当前页码
            pagesize: 5, //页面数据个数
            pageitem: pageitem,
            editIndex: -1,
            edititems: { name: null },

          },
          computed: {
            pageItems: function () {
              var startIndex = (this.pageindex - 1) * this.pagesize;
              var editIndex = startIndex + this.pagesize - 1;
              return this.items.filter(function (value, index) {
                return (
                  index >= startIndex &&
                  index <= editIndex
                );
              });
            }
          },
          methods: {
            //查询
            cha: function () {
              alert("查询")
            }


          }

        });
        return;
      });
    });



  </script>
</body>

</html>